<?php echo $this->Html->link("Add a new article", array("action" => "add")); ?>
<?php echo $this->Form->Create(array("action" => "delete")); ?>
<table>
	<tr>
		<th></th>
		<th><?php echo $this->Paginator->sort('title', 'Title'); ?></th>
		<th><?php echo $this->Paginator->sort('User.username', 'Author'); ?></th>
		<th>Categories</th>
		<th><?php echo $this->Paginator->sort('comment_count', 'Comments'); ?></th>
		<th><?php echo $this->Paginator->sort('created', 'Created'); ?></th>
		<th><?php echo $this->Paginator->sort('modified', 'Modified'); ?></th>
		<th><?php echo $this->Paginator->sort('id', 'ID'); ?></th>
	</tr>
	<?php foreach($articles as $article): ?>
	<tr>
		<td><?php echo $this->Form->checkbox('selectedArticles.', array("value" => $article['Article']['id'], "hiddenField" => false)); ?></td>
		<td><?php echo $this->Html->link($article['Article']['title'], array("action" => "edit/" . $article['Article']['id'])); ?></td>
		<td><?php echo $article['User']['username']; ?></td>
		<td>
			<?php foreach($article['Category'] as $category): ?>
			<?php echo $category['name']; ?>
			<?php endforeach; ?>
		</td>
		<td><?php echo $this->Html->link(count($article['Comment']), array("controller" => "comments", "action" => "index/" . $article['Article']['id'])); ?></td>
		<td><?php echo $article['Article']['created']; ?></td>
		<td><?php echo $article['Article']['modified']; ?></td>
		<td><?php echo $article['Article']['id']; ?></td>
	</tr>
    <?php endforeach; ?>
</table>
<?php echo $this->Form->End("Delete Selected"); ?>